package minio_client

import (
	"fmt"

	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
)

var MinioClient *minio.Client

func InitMinioClient() error {
	endpoint := "117.72.90.158:9000"
	accessKeyID := "root"
	secretAccessKey := "abc123456"
	client, err := minio.New(endpoint, &minio.Options{
		Creds:  credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
		Secure: false,
	})
	if err != nil {
		return fmt.Errorf("初始化Minio客户端失败: %v", err)
	}

	MinioClient = client
	return nil
}
